﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Data;
using CapaEntidades;

namespace CapaDatos
{
    public class daTipoCliente
    {
        public static List<enTipoCliente> ComboTipCli()              

        {
            SqlConnection cn = null;
            SqlCommand cmd = null;
            SqlDataReader dr = null;
            List<enTipoCliente> list = null;
            try
            {
                cn = Conexion.getConexion();
                cmd = new SqlCommand("comboTipCli", cn);
                cmd.CommandType = CommandType.StoredProcedure;
                cn.Open();
                list = new List<enTipoCliente>();
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    enTipoCliente est = new enTipoCliente();
                    est.tipCli_id = Convert.ToInt32(dr["tipCli_id"]);
                    est.tipCli_descripcion = dr["tipCli_descripcion"].ToString();
                    list.Add(est);
                }
            }
            catch (Exception e)
            {
                list = null;
            }
            finally
            {
                dr.Close();
            }
            return list;
        }
    }
}
